from fastadmin.middleware.BaseMiddleware import BaseMiddleware
from fastapi import Request
class Admin(BaseMiddleware):
    def __init__(self, app):
        super().__init__(app)
        self.module = 'admin'
        self.middleware = {
            # 模块名:{
            #     '方法名'(index作为通用中间件):中间件
            # }
            'index':{
                'test':self.test,
                'index':self.index
            }
        }
    #
    async def index(self, request: Request,call_next):
        print('admin/index中间件')
        return await call_next(request)
    async def test(self, request: Request,call_next):
        print('admin/test中间件')
        return await call_next(request)
